
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/22 0022
 * Time: 11:45
 */

//创建内存表
$table = new swoole_table(1024);

//内存表增加一列
$table->column('id', $table::TYPE_INT, 10);
$table->column('name', $table::TYPE_STRING, 255);
$table->column('age', $table::TYPE_INT, 3);
$table->create();

//添加数据
$table->set('singwa_imooc1',['id'=>1, 'name'=>'singwa', 'age'=>18]);
//另一种添加
$table['singwa_imooc2'] = [
    'id'=>2,
    'name'=>'singwa',
    'age'=>18
];
$table->incr('singwa_imooc2', 'age', 2);
$table->decr('singwa_imooc1', 'age', 3);

print_r($table->get('singwa_imooc1'));
print_r($table['singwa_imooc2']);
echo $table->count().PHP_EOL;

echo 'del_start:'.PHP_EOL;
echo $table->del('singwa_imooc2').PHP_EOL;
echo 'del_end:'.PHP_EOL;

print_r($table->get('singwa_imooc1'));
print_r($table['singwa_imooc2']);
echo $table->count().PHP_EOL;




